package CarRental;
//轿车类
public class Car extends Automobile {
    private String model;//型号

    public Car() {}
    public Car(String licensePlate, String brand, double dailyRent, String model) {
        super(licensePlate, brand, dailyRent);
        this.model = model;
    }
    public void showCar() {
        System.out.println("轿车  车牌：" + this.getLicensePlate()+ ",品牌" + this.getBrand() + " "+this.model+",日租金"
                +this.getDailyRent() + ",实时状态：" + (this.isState()? "可租" : "已租出"));
    }
    @Override
    public String toString() {
        return "轿车  车牌：" + Car.this.getLicensePlate() +
                        "，品牌" + Car.this.getBrand()+"\t车型"+this.model+
                        "，日租金" + Car.this.getDailyRent()+
                ",状态："+(Car.this.isState()?"可租":"已租出");
    }

    public double calculate(int day) {//计算租金
        double rental=getDailyRent()*day;
        if (day > 150)
            rental *= 0.7;
        else if (day > 30)
            rental *= 0.8;
        else if (day > 7)
            rental *= 0.9;
        return rental;
    }
    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }
}
